<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="org.json.*"%>
<%@ page import="org.jbpm.graph.def.*"%>
<%@ page import="org.jbpm.graph.exe.*"%>
<%@ page import="org.jbpm.taskmgmt.def.*"%>
<%@ page import="com.gzgi.framework.*"%>
<%@ page import="com.gzgi.framework.el.*"%>
<%@ page import="com.gzgi.framework.util.*"%>
<%@ page import="com.gzgi.framework.sys.model.*"%>
<%@ page import="com.gzgi.workflow.jbpm.util.*"%>
<%@ page import="com.gzgi.workflow.jbpm.model.*"%>
<%@ page import="com.gzgi.workflow.jbpm.context.*"%>
<%@ page import="com.gzgi.workflow.jbpm.config.*"%>
<%@ page import="com.gzgi.workflow.jbpm.container.*"%>
<%@ page import="com.gzgi.workflow.jbpm.datafield.*"%>
<%@ page import="com.gzgi.workflow.jbpm.mgmt.*"%>
<%@ page import="com.gzgi.workflow.jbpm.mgmt.product.*"%>
<%
    
	ProductController handler = (ProductController)ControllerFactory.getController("productController");
    String isAgree = request.getParameter("isAgree");
	String opinion = request.getParameter("opinion");
	String productId = request.getParameter("productId");
	String processName = request.getParameter("processName");
	String actionType = request.getParameter("actionType");
    String actorId = (String)session.getAttribute(SecurityContext.LOGIN_ACTOR_ID);
	boolean isOK = false;
	if(actorId != null){
		if("startProcess".equals(actionType)){
			if(processName == null){
				processName = "OrderProcess";
			}
			String processInstanceId = handler.startProcess(productId, processName, actorId);
			if(processInstanceId != null){
				isOK = true;
			}
		} else {
			  isOK = handler.complateTask(productId,  actorId, isAgree,  opinion, null);
		}
	}
%>
<script language="JavaScript">
    <%if(isOK){%>
	    alert("提交成功！");
	<%}else{%>
		alert("提交失败！");
	<%}%>

     location.href="productList.jsp";

</script>
